From 9427933f18c5d14ecb939c23627bea536e90e07c Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Tue, 27 Sep 2005 15:06:40 +0100 Subject: [PATCH] This patch adds a quick check in "xm save" to make sure the path given exists, and is writable. This will fix the issue detected by xm-test 03_save_bogusfile_neg. Signed-off-by: Dan Smith Signed-off-by: Ewan Mellor --- tools/python/xen/xm/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index acfd7047ee..0db2e8636d 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -175,6 +175,10 @@ def xm_save(args): dom = args[0] # TODO: should check if this exists savefile = os.path.abspath(args[1]) + + if not os.access(os.path.dirname(savefile), os.W_OK): + err("xm save: Unable to create file %s" % savefile) + sys.exit(1) from xen.xend.XendClient import server server.xend_domain_save(dom, savefile) -- 2.30.2